import { Outlet, Navigate } from "react-router-dom";
import { createRef } from "react";
import { SuspenseComponent } from "@/utils/MyFun";

const auth = {
  name: "权限管理",
  path: "/auth",
  component: <Outlet />,
  nodeRef: createRef(null),
  isHideen: false,
  meta: {
    title: "权限管理",
    icon: "cib:adguard",
    order: 3,
    keepAlive: true,
    // role: ['admin'],
    // requireAuth: true,
  },
  children: [
    {
      path: "/auth",
      element: <Navigate to="/auth/menu"></Navigate>,
      nodeRef: createRef(null),
      redirect: true,
    },
    {
      name: "菜单管理",
      path: "menu",
      element: SuspenseComponent("/auth/menu"),
      nodeRef: createRef(null),
      isHideen: false,
      meta: {
        title: "菜单管理",
        icon: "ic:twotone-menu-book",
        order: 1,
        keepAlive: true,
      },
    },
    {
      name: "接口管理",
      path: "resource",
      element: SuspenseComponent("/auth/resource"),
      nodeRef: createRef(null),
      isHideen: false,
      meta: {
        title: "接口管理",
        icon: "mdi:api",
        keepAlive: true,
        order: 2,
      },
    },
    {
      name: "角色管理",
      path: "role",
      element: SuspenseComponent("/auth/role"),
      nodeRef: createRef(null),
      isHideen: false,
      meta: {
        title: "角色管理",
        icon: "carbon:user-role",
        keepAlive: true,
        order: 3,
      },
    },
  ],
};

export default auth;
